def input_pwd():
    pwd = input('请输入密码：')

    if len(pwd) >=4:
        return pwd
    ex = Exception('密码长度不够')

    # 抛出异常
    raise ex

try:
    user_pwd = input_pwd()
    print(user_pwd)
except Exception as result:
    print('发现错误：%s' %result)
